Repository navigation
[CuTeDSL] Preserve unsigned dtypes in Vector helpers - #3961
Open
taking-lying-flat wants to merge 2 commits into
Open
taking-lying-flat wants to merge 2 commits into
taking-lying-flat wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unsigned Vector helpers can silently change the meaning of their results. For example, selecting Uint8
[128, 255]with an all-true mask returns an Int8 Vector;(selected.to(Float32) - 128) * 0.5then gives[-128, -64.5]instead of[0, 63.5].Preserve the known DSL element dtype when wrapping results of
where,full,broadcast_to, andouterproduct. Capture Numeric scalar dtypes before converting them to MLIR values, including whenfullhas no explicit dtype. This also fixes thefull_like,zeros_like,ones_like, andempty_likedelegates. Python-literal and untyped MLIR-value inference retain their existing behavior.Extend the existing Vector test file with two focused Uint8 regressions: eight runtime-input cases covering the four helpers' scalar/Vector branches, plus the numerical dequantization example. The runtime test also checks element extraction, unsigned float conversion, and unsigned min/max IR.
Validation with this checkout, Python 3.12.13 and
nvidia-cutlass-dsl==4.9.0.dev1MLIR components:python -m pytest -q test/python/CuTeDSL/test_vector_reduction_fastmath.py -k TestVectorDtypePreservation: 2 tests and 8 subtests passed. Both regressions and all eight helper cases fail with the main3e81d0d4implementations.[128, 255, 1, 64]and mask[True, True, False, True]gives where min/max 0/255, versus -128/64 on main. Runtimefulland scalarbroadcast_tochecks also preserve 128 instead of interpreting it as -128.git diff --checkpass. No CUDA kernels were run.The existing fastmath test expects
fastmath<reassoc>but these MLIR components emitfastmath<reassoc,nsz>; the same failure reproduces with the unmodified upstream test. Its assertion is unchanged.